<#include "../common/layout.ftl"/>
<@layout>
	<#if (member??)> 
	<div class="well">
	<h3>用户信息</h3>
		<table class="table table-bordered table-striped">
			<thead>
			  <tr>
				<th>真实姓名</th>
				<th>手机号码</th>
				<th>性别</th>
				<th>下单总数量</th>
				<th>下单总金额</th>
				<th>操作</th>
			  </tr>
			</thead>
			<tbody>
			  <tr>
				<td>
					${member.real_name}
				</td>
				<td>
					${member.cell_phone}
				</td>
				<td>
				  <#if member.sex == 0>
				  	<span class="label label-info">男</span>
				  <#elseif member.sex == 1>
				  	<span class="label label-warning">女</span>
				  <#else>
				  	<span class="label label-inverse">未知</span>
				  </#if>
				</td>
				<td>
				${member.order_count}
				</td>
				<td>
				${member.sum_money!"0"}
				</td>
				<td>
					<div class="btn-group">
						 <a class="btn btn-primary" href="/order/add3/${member.id}"><i class="icon-leaf icon-white"></i> 下 单</a>
					</div>
				</td>
			  </tr>
			</tbody>
		</table>  
	</div>
	
	<div class="well">
	<h3>历史订单</h3>
		<table class="table table-bordered table-striped">
			<thead>
			  <tr>
				<th>状态</th>
				<th>单号</th>
				<th>目标方向</th>
				<th>起点</th>
				<th>终点</th>
				<th>里程</th>
				<th>总金额</th>
				<th>支付方式</th>
				<th>订单类型</th>
				<th>下单时间</th>
				<th>司机姓名</th>
				<th>联系方式</th>
				<th>操作</th>
			  </tr>
			</thead>
			<tbody>
			<#list orderList as order>
			  <tr>
				   <td>
					  <#if order.order_state == 0>
					  	<span class="label">已派单</span>
					  <#elseif order.order_state == 1>
					  	<span class="label label-success">订单已接受</span>
					  <#elseif order.order_state == 2>
					  	<span class="label label-warning">到达出发地</span>
					  <#elseif order.order_state == 3>
					  	<span class="label label-important">开始代驾</span>
					  <#elseif order.order_state == 4>
					  	<span class="label label-info">结束代驾</span>
					  <#elseif order.order_state == 5>
					  	<span class="label label-inverse">已取消</span>
					  <#elseif order.order_state == 6>
					  	<span class="label label-inverse">待分派</span>
					  	<#elseif order.order_state == 7>
					  	<span class="label label-inverse">待客服审核</span>
					  	<#elseif order.order_state ==8>
					  	<span class="label label-inverse">未接取消</span>
					  	<#elseif order.order_state ==9>
					  	<span class="label label-inverse">已接取消</span>
					  	<#elseif order.order_state ==10>
					  	<span class="label label-inverse">未接取消已审</span>
					  	<#elseif order.order_state ==11>
					  	<span class="label label-inverse">已接取消已审</span>
					  	<#elseif order.order_state ==12>
					  	<span class="label label-inverse">已撤销</span>
					  	<#elseif order.order_state ==13>
					  	<span class="label label-inverse">撤销已审</span>
					  	<#elseif order.order_state ==14>
					  	<span class="label label-inverse">临时订单已审</span>
					  	<#elseif order.order_state ==15>
					  	<span class="label label-inverse">临时订单已取消</span>
					  <#else>
					  	<span class="label">其他</span>
					  </#if>
					</td>
				    <td>
					 ${order.id!""}
					</td>
					 <td>
					  ${order.userarea!" "}
					</td>
					<td>
					 ${order.startpoint!""}
					</td>
					<td>
					 ${order.endpoint!""}
					</td>
					<td>
					 ${order.kilometre!""}
					</td>
					<td>
					￥${order.totalmoney!""}
					</td>
					<td>
					 <#if order.pay_type == 0>
					  	<span class="label label-info">现金</span>
					  <#elseif order.pay_type == 1>
					  	<span class="label label-warning">企业支付</span>
					  <#elseif order.pay_type == 2>
					  	<span class="label label-success">VIP支付</span>
					  <#elseif order.pay_type == 3>
					  	<span class="label label-success">免费客户</span>
					  <#else>
					  	<span class="label label-inverse">其他</span>
					  </#if>
					</td>
					<td>
					   <#if order.order_type == 0>
					  	<span class="label label-info">普通</span>
					  <#elseif order.order_type == 1>
					  	<span class="label label-info">企业订单</span>
					  <#elseif order.order_type == 2>
					  	<span class="label label-info">酒店订单</span>
					  <#elseif order.order_type == 3>
					  	<span class="label label-info">KTV订单</span>
					   <#elseif order.order_type == 4>
					  	<span class="label label-info">VIP订单</span>
					  <#else>
					  	<span class="label label-inverse">其他</span>
					  </#if>
					</td>
					<td>
						 ${order.create_time!" "}
					</td>
					<td>
						 ${order.driver_name!" "}
					</td>
					<td>
						 ${order.driver_phone!" "}
					</td>
					<td>
						<a class="btn btn-primary" href="/order/addByHistory/${order.id}"><i class="icon-leaf icon-white"></i> 生成新订单</a>
					</td>
			  </tr>
			  </#list>
			</tbody>
		</table>  
	</div>
	
	
    <#else>
	 <div class="hero-unit">
        <h1>手机不存在</h1>
        <p>该客户未注册，请填写客户基本资料</p>
        <form id="form1" class="well form-horizontal" action="/order/add/0"  method="post">
        	<input type="hidden" name="member.id" value="0">
        	 <div class="control-group">
		        <label class="control-label" for="focusedInput">手机号码：</label>
		       <label class="control-label">
		         ${cell_phone!""}
		          <input class="input-xlarge focused" name="member.cell_phone" id="cellphone" type="hidden"  style="height: 26"  value="${cell_phone!""}">
		        </label>
		      </div>
	        <div class="control-group">
	        <label class="control-label" for="focusedInput">真实姓名：</label>
	        <div class="controls" >
	          <input class="input-xlarge focused" name="member.real_name" id="realname" type="text"  style="height: 26"  >
	        </div>
		      </div>
		      
		       <!--<div class="control-group">
		        <label class="control-label" for="focusedInput">车牌号码：</label>
		        <div class="controls" >
		          <input class="input-xlarge focused" name="member.plage_number" id="plage_number" type="text"  style="height: 26" >
		        </div>
		      </div>-->
		       <div class="control-group">
		        <label class="control-label" for="focusedInput">性别：</label>
		        <div class="controls" >
		        	<select id="sex" name="member.sex">
		                <option value="0" selected>男</option>
		                <option value="1">女</option>
		                <option value="2">未知</option>
		              </select>
		        </div>
		      </div>
		      <div class="form-actions">
		        <button type="submit" class="btn btn-primary" onsubmit="save()">确 定</button>
		        <button type="reset" class="btn">重 置</button>
		        <button type="button" class="btn btn-info" onclick="javascript:history.back();">返回</button>
		      </div>
		      </div>
	 	  </form>
	 	  <script>
			$(function() { 
		     $("#form1").validity(function() {
		         $("#realname").require();
		         $("#plage_number").require();
		     });
		     
		 }); 
		</script>
	</#if>   
</@layout>